Skip to content

Merge the two Object mutexes to save on RAM (1/4 down).#119985

Open
Ivorforce wants to merge 1 commit into
godotengine:masterfrom
Ivorforce:object-single-mutex
Open

Merge the two Object mutexes to save on RAM (1/4 down).#119985
Ivorforce wants to merge 1 commit into
godotengine:masterfrom
Ivorforce:object-single-mutex

Conversation

@Ivorforce
Copy link
Copy Markdown
Member

@Ivorforce Ivorforce commented Jun 2, 2026

What problem(s) does this PR solve?

Reduces non-Node Object size by ~88 bytes, which is around 1/4 of their total size (assuming empty).

Additional information

There's no real need to have two separate mutexes. Access to both is rare, and mutexes are huge.

Performance should be the same as before, or better. Object instantiation should be measurably faster (no additional allocation).

Note: Mostly untested right now (except for a quick compile and unit test/editor run).
The main risk I see is if I misinterpreted the signal code and this change introduces some deadlock potential.

@Ivorforce Ivorforce added this to the 4.x milestone Jun 2, 2026
@Ivorforce Ivorforce requested a review from hpvb June 2, 2026 23:53
@Ivorforce Ivorforce requested a review from a team as a code owner June 2, 2026 23:53
@Ivorforce Ivorforce requested review from RandomShaper and mihe June 2, 2026 23:54
Comment thread core/object/object.cpp Outdated
@Ivorforce Ivorforce force-pushed the object-single-mutex branch from aa90d5c to c426655 Compare June 4, 2026 09:37
@Ivorforce Ivorforce force-pushed the object-single-mutex branch from c426655 to a55313e Compare June 4, 2026 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants